#pragma once

#include <d3d9.h>
#include <d3dx9.h>
#include <string>

#pragma comment (lib, "d3d9.lib")
#pragma comment (lib, "d3dx9.lib")

class dxManager
{
public:
	dxManager(void);
	~dxManager(void);
	bool init(HWND hwnd);
	void shutdown(void);
	void beginRender(void);
	void endRender(void);
	IDirect3DSurface9* getSurfaceFromBitmap(std::string filename);

	IDirect3DSurface9* getBackBuffer(void);
	void blitToSurface(IDirect3DSurface9* srcSurface, const RECT *srcRect, const RECT *destRect);
	void printText(const int& phase);

	void GetTextureFromFile(char* filename, LPDIRECT3DTEXTURE9* texture);
	void ShowTextureOverlay(LPDIRECT3DTEXTURE9 texture, const D3DXVECTOR3& dest);

	void printColorVictoryText(const int& p1Color1, const int& p1Color2,
								const int& p2Color1, const int& p2Color2);

	void PrintScore(int score1, int score2);

private:
	HRESULT                 lastResult;
	LPDIRECT3D9             pD3D;
	LPDIRECT3DDEVICE9       pd3dDevice;
	LPD3DXFONT				m_font;
	LPD3DXSPRITE			spriteDevice;
	LPD3DXFONT				v_font;
};
